package controllers;

import entidades.Producto;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;

@Named(value = "productoController")
@ViewScoped
public class ProductoController extends AbstractController<Producto> {

    @Inject
    private DetalleventaController detalleventaCollectionController;

    public ProductoController() {
        // Inform the Abstract parent controller of the concrete Producto?cap_first Entity
        super(Producto.class);
    }

    /**
     * Resets the "selected" attribute of any parent Entity controllers.
     */
    public void resetParents() {
    }

    /**
     * Sets the "items" attribute with a collection of Detalleventa entities
     * that are retrieved from Producto?cap_first and returns the navigation
     * outcome.
     *
     * @return navigation outcome for Detalleventa page
     */
    public String navigateDetalleventaCollection() {
        if (this.getSelected() != null) {
            FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Detalleventa_items", this.getSelected().getDetalleventaCollection());
        }
        return "/detalleventa/index";
    }

}
